<include file="Public:header" />
<div class="page-member subpage">
    <div class="form-header">
        <div>
            <div class="line1">
                <div class="fl"><h3>房源信息详情 / {$house.name}（{$house.state}）</h3></div>
                <div class="fr hidden">
                    <form class="search-form" method="post" action="">
                        <input name="field" value="{$context.field}" type="hidden" />
                        <input name="value" value="{$context.value}" type="hidden" />
                        <input name="page" value="{$context.page}" type="hidden" />
                        <input name="order_field" value="{$context.order_field}" type="hidden" />
                        <input name="order_sort" value="{$context.order_sort}" type="hidden" />
                        <input name="offset" value="{$context.offset}" type="hidden" />
                        <input name="where" value='{$context.where}' type="hidden" />
                        <input name="id" value="{$context.id}" type="hidden" />
                    </form>
                </div>
            </div>
            <div class="line2">
                <!-- 编辑按钮组 -->
                <div class="fl form-btn-group btn-group-edit">
                    <in name="$x|default='02-03-06'" value="$rightsCode">
                        <button onclick="action_edit();" class="btn-save btn-highlight">编 辑</button>
                        <else />
                        <button disabled="disabled" class="btn-save btn-disable">编 辑</button>
                    </in>
                    <span>或</span>
                    <a class="linkBtn btn-abort" href="/admin/house/add">创建</a>
                </div>
                <!-- 保存按钮组 -->
                <div class="fl form-btn-group btn-group-save hidden">
                    <button onclick="action_save();" class="btn-save btn-highlight">保 存</button>
                    <span>或</span>
                    <a class="linkBtn btn-abort" onclick="action_abort();" href="javascript:void(0);">放弃</a>
                </div>
                <div class="fl form-btn-more">
                    <button class="btn-normal btn-more">
                        更多操作<i class="drop-down"></i>
                    </button>
                    <ul class="more-action hidden">
                        <in name="$x|default='02-03-07'" value="$rightsCode">
                            <li><a onclick="action_del2();" href="javascript:void(0);">删 除</a></li>
                        </in>
                        <in name="$x|default='02-03-06'" value="$rightsCode">
                            <li><a onclick="action_copy();" href="javascript:void(0);">复 制</a></li>
                        </in>
                    </ul>
                </div>
                <div class="fr form-search-count">
                    <span class="index">{$context.index}/{$page.total}</span>
                    <button onclick="ItemJump({$page.prev.id}, {$page.prev.offset});" class="btn-normal">上一条</button>
                    <button onclick="ItemJump({$page.next.id}, {$page.next.offset});" class="btn-normal">下一条</button>
                </div>
            </div>
        </div>
    </div>
    <div class="form-box2">
        <div style="border-bottom:0;padding-bottom:0;">
            <form id="houseForm" method="post" action="">
                <!--表单相关原始信息存储-->
                <input type="hidden" name="old_community_id" value="{$house.community_id}" />
                <input type="hidden" name="old_building_id" value="{$house.building_id}" />
                <input type="hidden" name="old_building_name" value="{$building[$house[building_id]]}" />
                <input type="hidden" name="old_name" value="{$house.name}" />
                <input type="hidden" name="old_price" value="{$house.price}" />
                <input type="hidden" name="old_mprice" value="{$house.mprice}" />
                <input type="hidden" name="old_type" value="{$house.type}" />
                <input type="hidden" name="old_type_name" value="{$type[$house[type]]}" />
                <input type="hidden" name="old_addr" value="{$house.addr}" />
                <input type="hidden" name="old_dybh" value="{$house.dybh}" />
                <input type="hidden" name="old_huxing" value="{$house.huxing}" />
                <input type="hidden" name="old_size" value="{$house.size}" />
                <input type="hidden" name="old_direction" value="{$house.direction}" />
                <input type="hidden" name="old_remarks" value="{$house.remarks}" />
                <input type="hidden" name="old_phone" value="{$house.phone}" />
                <input type="hidden" name="old_jtnum" value="{$house.jtnum}" />
                <input type="hidden" name="old_zhname" value="{$house.zhname}" />
                <input type="hidden" name="old_zhname2" value="{$house.zhname2}" />
                <input type="hidden" name="old_zhidno" value="{$house.zhidno}" />
                <input type="hidden" name="old_zhidno2" value="{$house.zhidno2}" />
                <input type="hidden" name="old_dibaohm" value="{$house.dibaohm}" />
                <input type="hidden" name="old_dbnum" value="{$house.dbnum}" />
                <table class="form">
                    <tr>
                        <th width="15%">小区名称<span class="hint">*</span></th>
                        <td width="35%" field="community_id">{$community[$house[community_id]]}</td>
                        <th width="15%">建筑物名称<span class="hint">*</span></th>
                        <td field="building_id">{$building[$house[building_id]]}</td>
                    </tr>
                    <tr>
                        <th>房源编号<span class="hint">*</span></th>
                        <td field="name">{$house.name}</td>
                        <th>单元编号<span class="hint">*</span></th>
                        <td field="dybh">{$house.dybh}</td>
                    </tr>
                    <tr><th>房源地址</th>
                        <td field="addr">{$house.addr}</td>
                        <th>朝向</th>
                        <td field="direction">{$house.direction}</td>
                    </tr>
                    <tr style="vertical-align: top">
                        <th>面积</th>
                        <td field="size">{$house.size}</td>
                        <th>户型</th>
                        <td field="huxing">{$house.huxing}</td>
                    </tr>
                    <tr>
                        <th>租金<span class="hint">*</span></th>
                        <td field="price">{$house.price}</td>
                        <th>市场租金</th>
                        <td field="mprice">{$house.mprice}</td>
                    </tr>
                    <tr style="vertical-align: top">
                        <th>房源类型</th>
                        <td field="type">{$house.type}</td>
                        <th>备注</th>
                        <td field="remarks">{$house.remarks}</td>
                    </tr>
                </table>
            </form>
        </div>
        <div class="sub-listview" style="height:255px;">
            <ul class="ui-tabs">
                <li class="selected" target="tabs-zhuhu">住户信息</li>
                <li target="tabs-rental">租赁记录</li>
                <li target="tabs-repair">维修记录</li>
            </ul>
            <div class="tabs-item tabs-zhuhu">
                <table class="form" style="margin-left:20px;margin-top:10px;">
                    <tr>
                        <th width="15%">姓名</th>
                        <td width="35%" field="zhname">{$house.zhname}</td>
                        <th width="15%">配偶姓名</th>
                        <td field="zhname2">{$house.zhname2}</td>
                    </tr>
                    <tr>
                        <th>身份证</th>
                        <td field="zhidno">{$house.zhidno}</td>
                        <th>配偶身份证</th>
                        <td field="zhidno2">{$house.zhidno2}</td>
                    </tr>
                    <tr>
                        <th>低保证号</th>
                        <td field="dibaohm">{$house.dibaohm}</td>
                        <th>低保人口</th>
                        <td field="dbnum">{$house.dbnum}</td>
                    </tr>
                    <tr>
                        <th>联系电话</th>
                        <td field="phone">{$house.phone}</td>
                        <th>家庭人口</th>
                        <td field="jtnum">{$house.jtnum}</td>
                    </tr>
                </table>
            </div>
            <div class="tabs-item tabs-rental hidden">
                <table class="list" style="margin-top:10px;">
                    <thead>
                        <tr>
                            <th>申请编号</th>
                            <th>保障对象</th>
                            <th>身份证</th>
                            <th>入住日期</th>
                            <th>退出日期</th>
                            <th>退出原因</th>
                            <th>操作员</th>
                        </tr>
                    </thead>
                    <tbody>
                        <volist name="rental" id="vo">
                            <tr>
                                <td>{$vo.yw_no}</td>
                                <td>{$vo.bzdx}</td>
                                <td>{$vo.idno}</td>
                                <td>{$vo.date1}</td>
                                <td>{$vo.date2}</td>
                                <td>{$vo.remarks}</td>
                                <td>{$vo.cuser}</td>
                            </tr>
                        </volist>
                    </tbody>
                </table>
            </div>
            <div class="tabs-item tabs-repair hidden">
                <table class="list" style="margin-top:10px;">
                    <thead>
                    <tr>
                        <th>维修单号</th>
                        <th>报修人</th>
                        <th>报修描述</th>
                        <th>维修师父</th>
                        <th>维修费用</th>
                        <th>报修日期</th>
                        <th>维修状态</th>
                    </tr>
                    </thead>
                    <tbody>
                    <volist name="repair" id="vo">
                        <tr>
                            <td>{$vo.no}</td>
                            <td>{$vo.bxr}</td>
                            <td>{$vo.bxms}</td>
                            <td>{$vo.wxsf}</td>
                            <td>{$vo.wxfy}</td>
                            <td>{$vo.bxrq}</td>
                            <td>{$vo.wxzt}</td>
                        </tr>
                    </volist>
                    </tbody>
                </table>
            </div>
        </div>
    </div>
</div>
<div class="dialog-reqnianshen dialog hidden">
    <div class="box">
        <div class="title">
            <h4 class="fl">年审设置单对话框</h4>
            <span class="fr"><a href="#" onclick="closeDialog();">关闭</a></span>
        </div>
        <table class="form-tab" style="margin-top:50px;">
            <tr>
                <th width="120">是否需要年审：</th>
                <td>
                    <input name="req_nianshen" class="pse-radio" type="checkbox" <if condition="$house.req_nianshen eq 是">checked="checked"</if> value="是" /><label>是</label>
                    <input name="req_nianshen" class="pse-radio" type="checkbox" <if condition="$house.req_nianshen eq 否">checked="checked"</if> value="否" /><label>否</label>
                    <label style="margin-left:10px;color:red;">*必填项</label>
                </td>
            </tr>
            <tr>
                <td colspan="2" style="text-align: center;line-height:80px;">
                    <button class="btn btn-highlight" onclick="action_setNS();">提交</button>
                    <span>或</span>
                    <a href="#" onclick="closeDialog();" class="linkBtn">放弃</a>
                </td>
            </tr>
        </table>
    </div>
</div>
<script>
    function action_setNS(){
        var dataId = $("input[name=id]").val();
        var dataIds = new Array(dataId);
        var state = fn_GetRadioValue('req_nianshen');
        $.ajax({
            url: '/admin/house/ajax_UpdateNS',
            dataType: 'json',
            data: {info:dataIds, state:state},
            type: 'post',
            success: function(res){
                if(res.status){
                    alert("操作成功");
                    location.reload();
                }else{
                    alert(res.info);
                }
            }
        });
    }
    /**
     * 全局变量 fields // todo
     * community_id building_id name dybh
     */
    var fields = new Array("type", "zhname", "zhidno", "zhname2", "zhidno2", "dibaohm", "dbnum","price","mprice",
                "name", "addr", "size", "dybh", "direction","huxing", "phone", "jtnum", "remarks");
    var community_options = {$community_options};
    var building_options = {$building_options};
    var type_options = {$type_options};
</script>
<script src="__JS__/house.js?v=0.1" type="text/javascript" ></script>
<include file="Public:footer" />
